package icu.sehnen.controller;

import icu.sehnen.common.CommonResult;
import icu.sehnen.model.CompanyModel;
import icu.sehnen.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.awt.*;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/company")
public class CompanyController  {

    @Autowired
    CompanyService companyService;

    @RequestMapping("/list")
    public CommonResult findAll(){
        CompanyModel companyModel=companyService.findAll();
        return  CommonResult.success(companyModel);
    }
    @PostMapping("/update")
    public CommonResult updateImg(CompanyModel companyModel){
       Integer res= companyService.update(companyModel);
       if(res == 1){
           return  CommonResult.success();
       }
       return  CommonResult.failed();

    }

}
